package nc.ui.cad.testscope;

import java.awt.event.ItemEvent;

import nc.bs.logging.Logger;
import nc.ui.pub.beans.UIRefPane;
import nc.ui.pub.beans.ValueChangedEvent;
import nc.ui.trade.bill.ICardController;
import nc.ui.trade.card.BillCardUI;
import nc.ui.trade.controller.IControllerBase;

public class IvjEventHandler  implements java.awt.event.ItemListener, nc.ui.pub.beans.ValueChangedListener {
	private BillCardUI m_billUI = null;

	private IControllerBase m_ctl = null;
	
	public IvjEventHandler(BillCardUI billUI, ICardController control) {
		super();
		m_billUI = billUI;
		m_ctl = control;
	}

	public void itemStateChanged(ItemEvent paramItemEvent) {
		// TODO Auto-generated method stub
	}

	public void valueChanged(ValueChangedEvent event) {
		try {
			UIRefPane corpRefPanel = ((TestScopeUI)m_billUI).getCorpPanel();
			String strWhere = "isnull(dr,0)=0";
			if(corpRefPanel.getRefPK()!=null && !"".equals(corpRefPanel.getRefPK().trim())){
				strWhere = strWhere + " and pk_corp = '" + corpRefPanel.getRefPK() + "'";
			}else{
				strWhere = strWhere + " and pk_corp is null";
			}
			((TestScopeUI)m_billUI).setInitStrWhere(strWhere);
			((TestScopeUI)m_billUI).initData();
		} catch (Exception e) {
			Logger.error(e.getMessage(), e);
		}
	}
}
